package com.example.team.controller;

import com.example.team.entity.Offduty;
import com.example.team.service.IOffdutyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 作者:王轩
 * date: 2023/10/31
 **/
@RestController
@Api(tags = "销假管理系统")
public class OffdutyController {
    @Autowired
    private IOffdutyService offdutyService;
    @RequestMapping(value = "/Offduty",method = {RequestMethod.GET})
    public String Offduty(){
        return "销假信息管理系统";
    }
    //添加方法
    @ApiOperation(value = "添加销假信息")
    @RequestMapping(value = "/insterOffduty",method = {RequestMethod.GET})
    public  Integer insterOffduty(Offduty offduty){
        return offdutyService.insertOffduty(offduty);
    }
    //删除方法
    @ApiOperation(value = "删除销假信息")
    @RequestMapping(value = "/deleteOffduty",method = {RequestMethod.GET})
    public Integer deleteOffduty(Integer OffdutyID){
        Offduty offduty =new Offduty();
        offduty.setOffDutyID(OffdutyID);
        return offdutyService.deleteOffduty(offduty);
    }
    //修改方法
    @ApiOperation(value = "修改销假信息")
    @RequestMapping(value = "/updateOffduty",method = {RequestMethod.GET})
    public Integer updateOffduty(Offduty offduty){
        return offdutyService.updateOffduty(offduty);
    }
    //查询方法
    @ApiOperation(value = "查询所有销假信息")
    @RequestMapping(value = "/getAllOffduty",method = {RequestMethod.GET})
    public List<Offduty> getAllOffduty(Offduty offduty){
        return offdutyService.getAllOffduty(offduty);
    }
}
